//企业公司认证
import React, { Component } from 'react';
import {
    View
} from 'react-native';

import { SelCompanyMobAction } from '../../../actions/company';      //加载action
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

import Cattestation_top from './cattestation_top'
import Cattestation_body from './cattestation_body'

class Cattestation_all extends Component {
    //加载后渲染页面
    componentDidMount() {
        const { actions } = this.props;
        actions.SelCompanyMobAction(); //初始化查询
    }

    render() {
        return (
            <View style={{ backgroundColor: "#f6f6f6", flex: 1 }}>
                <Cattestation_top navigation={this.props.navigation} />
                <Cattestation_body
                    actions={this.props.actions}
                    xzCompany={this.props.company.data.xzCompany}
                    navigation={this.props.navigation} />
            </View>
        )
    }
}

//组合action
var actions = {
    SelCompanyMobAction,
}
//连接state到props
const mapStateToProps = state => {
    return {
        company: state.Sel_CompanyMobReducer             //自己的reducers
    }
}
//连接action
const mapDispatchToProps = (dispatch) => {
    return {
        actions: bindActionCreators(actions, dispatch)
    }
}
//导出组合好的组件(组合后状态改变重新渲染组合组件的页面)
export default connect(
    mapStateToProps, mapDispatchToProps
)(Cattestation_all);